package states 
{
  import org.despair2D.model.RangeWrapProperty;
  import org.despair2D.ui.events.ManipulateEvent;
  import org.despair2D.ui.LabelButton;
  import org.despair2D.ui.MultiFusion;
  import org.despair2D.ui.UIState
	
	public class MultiUIState extends UIState 
	{
	
		public var mStateList:Array =
		[
			ImageState,
			StartingState,
			AnimeState,
			NineScaleState,
		]
	
		override public function enter( stateArgs:Array ) : void
		{
			var multi:MultiFusion
			var btn:LabelButton
			
			multi = new MultiFusion()
			multi.setState(mStateList[0])
			this.fusion.addElement(multi)
			
			btn = new LabelButton('Btn_A', 'prev')
			this.fusion.addElement(btn,200,10)
			btn.addEventListener(ManipulateEvent.CLICK, function(e:ManipulateEvent):void
			{
				mRangeWrap.value--
			})
			
			btn = new LabelButton('Btn_A', 'next')
			this.fusion.addElement(btn,300,10)
			btn.addEventListener(ManipulateEvent.CLICK, function(e:ManipulateEvent):void
			{
				mRangeWrap.value++
			})
			
			mRangeWrap = new RangeWrapProperty(0, 0, 3, 1)
			mRangeWrap.binding(function():void
			{
				multi.setState(mStateList[mRangeWrap.value])
			},false)
		}
		
		override public function exit() : void
		{
      
		}
		
		private var mRangeWrap:RangeWrapProperty
	}
}